package com.jubaozan.service.platform.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jubaozan.c3.framework.utils.ResultHolder;
import com.jubaozan.service.platform.decorator.PlatformMessageDecorator;
import com.jubaozan.service.platform.vo.PlatformDetailsVO;
import com.jubaozan.service.platform.vo.PlatformSearchVO;
import com.jubaozan.service.platform.vo.StoreListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName PlatformMessageController
 * @Description 个体平台入驻信息相关接口Controller
 * @Author SunWei
 * @Version 1.0
 **/
@Api(tags = {"个体平台入驻信息相关接口"}, value = "个体平台入驻信息相关接口")
@RestController
@RequestMapping("/admin/message")
@Validated
public class PlatformMessageController {

    private final PlatformMessageDecorator platformMessageDecorator;

    public PlatformMessageController(PlatformMessageDecorator platformMessageDecorator) {
        this.platformMessageDecorator = platformMessageDecorator;
    }


    @ApiOperation(value = "平台入驻信息列表")
    @GetMapping("")
    public ResultHolder<IPage<StoreListVO>> query(PlatformSearchVO platformSearchVO,
                                                 @RequestParam(required = false, defaultValue = "1") Integer pageNo,
                                                 @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
        return ResultHolder.success(platformMessageDecorator.query(platformSearchVO,pageNo,pageSize));
    }

    @ApiOperation(value = "平台入驻详情信息")
    @GetMapping("/{storeId}")
    public ResultHolder<PlatformDetailsVO> details(@PathVariable("storeId") Long storeId, @RequestParam(required = false,value = "isDetails") Boolean isDetails ) {
        return ResultHolder.success(platformMessageDecorator.details(storeId,isDetails));
    }
}
